package com.itheima.travel.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@SuppressWarnings("ALL")
/**
 * @Description :springmvc配置类
 * @author     :LD
 */
//声明配置类
@Configuration
//注解扫描
@ComponentScan("com.itheima.travel.controller")
public class SpringMvcConfig extends WebMvcConfigurationSupport {
    /**
     * 文件上传解析器
     */
    public CommonsMultipartResolver multipartResolver(){
        CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
        //文件大小
        commonsMultipartResolver.setMaxUploadSize(104857600);
        //内存大小
        commonsMultipartResolver.setMaxInMemorySize(4096);
        //默认编码
        commonsMultipartResolver.setDefaultEncoding("UTF-8");
        return commonsMultipartResolver;
    }
}
